package net.es.weathermap.sched;

import java.util.Date;

import org.quartz.Scheduler;
import org.quartz.SchedulerException;
import org.quartz.SchedulerFactory;
import org.quartz.impl.StdSchedulerFactory;

public class JobScheduler {
    private Scheduler scheduler = null; 
    
    private static JobScheduler instance;
    public static JobScheduler getInstance() {
        if (instance == null) {
            instance = new JobScheduler();
        } 
        
        return instance;
    }
    
    public Scheduler getScheduler() {
        return scheduler;
    }

    public void start() {
        SchedulerFactory sf = new StdSchedulerFactory();
 
        // SchedulerManager.getInstance().start();
        // Scheduler sch = SchedulerManager.getScheduler();
     
        try {
            this.scheduler = sf.getScheduler();
            this.scheduler.start();
            // this.scheduler.start();
        } catch (SchedulerException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

    }

}
